import request from '@/utils/request'
import {getToken} from '../login'
import axios from '../../utils/axios'

// 查询车辆信息列表
export function listVehicles(query) {
  return request({
    url: '/wx/vehicles/list',
    method: 'get',
    params: query
  })
}

// 查询车辆信息详细
export function getVehicles(carId) {
  return request({
    url: '/wx/vehicles/' + carId,
    method: 'get'
  })
}

// 新增车辆信息
export function addVehicles(data) {
  return request({
    url: '/wx/vehicles',
    method: 'post',
    data: data
  })
}

// 修改车辆信息
export function updateVehicles(data) {
  return request({
    url: '/wx/vehicles',
    method: 'put',
    data: data
  })
}

// 删除车辆信息
export function delVehicles(carId) {
  return request({
    url: '/wx/vehicles/' + carId,
    method: 'delete'
  })
}

export function getVehiclesList(keyword,pageNumber,pageSize) {
  return axios.post('https://api.ly-gps.com/lygps-api/v2/car/list',
    {
      keyword: keyword,
      pageNumber: pageNumber,
      pageSize: pageSize,
    },
    {
      headers:{
        identityId:sessionStorage.getItem('identityId'),
        token:sessionStorage.getItem('token')
      }
    })
}
